<!--
	作者：2575202388@qq.com
	时间：2018-10-14
	描述：文化课辅导班搜索
-->
<template>
    <div style="width:100%;"> 
        <Tetable ref="tdtable" height="450" :columns="columns9" type="post" 
        	:paramiters="tj" 
        	:serverUrl="serverUrl"
        	@getSelection="getSelection"></Tetable>
    	<edit ref="editbm" v-on:reload="load()" :editparams="editparams"></edit>
    	<lookbmqk ref="lookbmqk" :wsid="wsid"></lookbmqk>
    </div> 
</template>
<script>
	import EditDelLook from "./EditDelLook";
	import edit from "./edit";
	import lookbmqk from "./lookbmqk/manage";
    export default {
    	name: "bmss",
    	props: {
    		tj:{
    			type: Object
    		}
    	},
        data () {
            return {
            	serverUrl:"/host/stgl/whk/Search_whkfdb.html?bmlb=1",
                columns9: [
                    {
                        type: 'selection',
                        width: 60,
                        align: 'center'
                    },{
                        type: 'index',
                        width: 60,
                        title: '序号',
                        align: 'center'
                    },{
                        title: '名称',
                        key: 'MC',
                        align: 'center',
                    },{
                        title: '年级',
                        key: 'NJ',
                        align: 'center'
                    },{
                        title: '班级',
                        key: 'BJ',
                        align: 'center'
                    },{
                        title: '收费介绍',
                        key: 'JJ',
                        align: 'center',
                        width: 500,
                    },{
                        title: '费用',
                        key: 'FY',
                        align: 'center'
                    },
                    {
                        title: '人员限额',
                        key: 'XE',
                        align: 'center'
                    },{
                        title: '收费截止时间',
                        key: 'SFJZSJ',
                        align: 'center'
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 120,
                        align: 'center',
                        render: (h, params) => {
                            return h(EditDelLook, {
                            	on: {
                            		//查看报名情况
                            		lookbmqk: () => {
               							this.wsid=params.row.WID;
										this.$refs.lookbmqk.modal0=true;
                                    },
                                    
                                    //删除文化课辅导班
                                    removeWhkfdb: () => {
                                    	const rows=params.row;
                                        this.remove(rows.WID)
                                    },
                                    
                                    //修改文化课辅导班
                                    editbm: () =>{
                                    	const rows=params.row;
                                    	
                                    	var whksf=rows.whksf;
                                    	var whkarr=[];
                                    	for(var i=0;i<whksf.length;i++){
                                    		const sf={
                                    			xmmc:whksf[i].XMMC,
												fee:whksf[i].FEE,
                                    		}
                                    		whkarr.push(sf);
                                    	}
                                    	
                                    	var whkteas=rows.whkteas;
                                    	var teaarr=[];
                                    	for(var i=0;i<whkteas.length;i++){
                                    		const tea={
                                    			tid:whkteas[i].TID,
                                    			tname:whkteas[i].TNAME,
                                    			jianjie:whkteas[i].JIANJIE,
                                    		}
                                    		teaarr.push(tea);
                                    	}
                                    	const edits={
                                    		wid:rows.WID,
											nj:rows.NJ+"",
											bj:rows.BJ+"",
											mc:rows.MC,
											jj:rows.JJ,
											fy:rows.FY+"",
											xe:rows.XE+"",
											sksj:rows.SKSJ,
											skdd:rows.SKDD,
											bmzlsm:rows.BMZLSM,
											sfjzsj:rows.SFJZSJ,
											whksf:whkarr,
											teachers:teaarr
                                    	};
 
                                    	this.editparams=edits;
										this.$refs.editbm.openmodal();
                                    },
                                    
                                }
                            });
                        }
                    }
                ],
                editparams:{},
                wsid:'',
            }
        },
        computed: {
		},
		methods: {
			//删除文化课辅导班
			remove:function(wid){
                this.$Modal.confirm({
                    title: '警告',
                    content: '请确定是否删除！！！',
                    onOk: () => {
                    	//执行删除代码
                    	this.$http.get("/host/stgl/whk/del_whkfdb.html?wid="+wid)
						.then(result => {
							//删除成功 刷新页面
							this.$Message.info('删除成功');
							this.$refs.tdtable.load();
						});
                    }
                });
			},
			
			
			load(){
				this.$refs.tdtable.load();
			},

			getSelection(datas){
				var selects=[...datas];
				this.$emit('getSelection',selects);
			}
	    },
		mounted() {
		},
		watch:{
		},
		components: {
			EditDelLook,
			edit,
			lookbmqk
		}
    }
</script>


<style scoped="scoped">
	
	.ivu-table-wrapper {
		border:none;
	}
	
	.toolstipdiv{
		width: '100%';
		overflow: 'hidden';
		textOverflow: 'ellipsis';
		whiteSpace: 'normal';
		wordBreak: 'break-all';
		color:'#fff';
		text-align: center;
	}
	.toolstipdiv:hover{
		background:rgb(63, 193, 201);
	}
	
	.ivu-tooltip-rel label:hover{
		color:#0023FB;
	}
	
	.tablediv{
		height: '40px';
		overflow:'hidden';
		line-height: '40px';
	}
</style>



